{extend name="public/layout" /}
{block name="body"}
    <style>
        .layui-form-label{
            width: 200px;
        }
        .layui-input-block{
            margin-left: 250px;
        }
    </style>
    <form class="layui-form" >
        <div class="layui-card pd-bt-15">
            {foreach name="list" item="item"}
            <div class="layui-row">
                <div class="layui-col-md6">
                    <div class="layui-form-item">
                        <label class="layui-form-label">{$item.name}</label>
                        <div class="layui-input-block">
                            {if condition="$item.alias eq message_default_status"}
                                <select name="{$item.id}">
                                    <option {if condition="$item.value eq 1"} selected {/if} value="1">是</option>
                                    <option {if condition="$item.value eq 0"} selected {/if}  value="0">否</option>
                                </select>
                                {else}
                                <input name="{$item.id} "type="text" value="{$item.value}" class="layui-input">
                            {/if}
                        </div>
                    </div>
                </div>
            </div>
            {/foreach}
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
            </div>
        </div>
    </form>
{/block}

{block name="script"}
    <script>
        layui.use(['form','upload'],function(){
            var form = layui.form,
                $ = layui.$;
            form.on('submit(*)', function(data){
                var url =  "{:url('update')}";
                $.post(url,data.field,function(data){
                    if(data.code == 10000)
                    {
                        layer.msg(data.msg,{icon:1,time:1500},function(){
                            window.location.href = "{:url('index')}";
                        })
                    }else{
                        layer.msg(data.msg,{icon:2,time:1500})
                    }

                });
                return false;
            });
        });
    </script>
{/block}